package com.hsy.crm.web.web.basics;

import com.hsy.crm.web.domain.cm.Response;
import com.hsy.crm.web.domain.cm.Unified;
import com.hsy.crm.web.domain.entity.Resubject;
import com.hsy.crm.web.domain.vo.resubject.ResubjectPageVo;
import com.hsy.crm.web.service.impl.ResubjectService;
import com.hsy.crm.web.web.BaseAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/resubject")
public class ResubjectAction extends BaseAction {

    @Autowired
    ResubjectService resubjectService;

    @RequestMapping("/insert")
    public String insert(Resubject resubject) {
        return Response.body(Unified.newInstance(resubjectService.insert(resubject)));
    }

    @RequestMapping("/update")
    public String update(Resubject resubject) {
        return Response.body(Unified.newInstance(resubjectService.update(resubject)));
    }

    @RequestMapping("/delete")
    public String delete(Resubject resubject) {
        return Response.body(Unified.newInstance(resubjectService.delete(resubject)));
    }

    @RequestMapping("/select")
    public String select(Resubject resubject) {
        resubject.setCompanyId(resubject.getLoginCompanyId());
        return Response.body(Unified.newInstance(resubjectService.select(resubject)));
    }

    @RequestMapping("/get")
    public String get(Resubject resubject) {
        return Response.body(Unified.newInstance(resubjectService.selectOne(resubject)));
    }

    @RequestMapping("/page")
    public String page(ResubjectPageVo resubjectPageVo) {
        return Response.body(resubjectService.page(resubjectPageVo));
    }

}
